package org.news.web.utils;

import java.io.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

public class TYutils {
    public static Map<String, Object> dictionaryMap = new HashMap<>();

    static{
        /**
         * 构造生成敏感词库
         */
        try {
//            一行一行读取
            BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream("C:\\Users\\HM\\Desktop\\biyesheji\\ty.txt")));
            String s = "";
//            读取数据
            while((s = bufferedReader.readLine()) != null){
                dictionaryMap.put(s,null);
            }
            System.out.println(dictionaryMap);
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }



    public static boolean contiansKey(String key){
        return dictionaryMap.containsKey(key);
    }
}
